﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;

public partial class Admin_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session[Global.SESSION_LOGGED_ADMIN] != null)
                lbSession.Text = ((TblUserAccount)Session[Global.SESSION_LOGGED_ADMIN]).FirstName + " " + ((TblUserAccount)Session[Global.SESSION_LOGGED_ADMIN]).LastName;
            Page.Title = "Admin Page";
        }

    }
    protected void btnLogout_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            Session[Global.SESSION_LOGGED_ADMIN] = null;
            Session.RemoveAll();
            Session.Clear();
            Response.Redirect("~/Admin/Login.aspx", false);
        }
        catch (Exception ex)
        {
            Session[Global.SESSION_ERROR] = ex;
            Response.Redirect(Global.ERROR_PAGE_ADMIN);
        }
    }
}
